.class public Lcom/nemustech/regina/ImagePlater;
.super Ljava/lang/Object;
.source "ImagePlater.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/nemustech/regina/ImagePlater$PaintPanelDelegate;
    }
.end annotation


# static fields
.field private static final BMP_CONFIG:Landroid/graphics/Bitmap$Config; = null

.field private static final TAG:Ljava/lang/String; = "ImagePlater"


# instance fields
.field private mDstRect:Landroid/graphics/Rect;

.field private mReginaLauncher:Lcom/nemustech/regina/ReginaLauncher;

.field private mReginaPref:Lcom/nemustech/regina/ReginaPreference;

.field private mResCare:Lcom/nemustech/regina/ResourceCare;

.field private mSrcRect:Landroid/graphics/Rect;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 18
    sget-object v0, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    sput-object v0, Lcom/nemustech/regina/ImagePlater;->BMP_CONFIG:Landroid/graphics/Bitmap$Config;

    return-void
.end method

.method public constructor <init>(Lcom/nemustech/regina/ReginaLauncher;)V
    .locals 1
    .parameter "reginaLauncher"

    .prologue
    .line 30
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 19
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mSrcRect:Landroid/graphics/Rect;

    .line 20
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mDstRect:Landroid/graphics/Rect;

    .line 31
    iput-object p1, p0, Lcom/nemustech/regina/ImagePlater;->mReginaLauncher:Lcom/nemustech/regina/ReginaLauncher;

    .line 32
    invoke-static {p1}, Lcom/nemustech/regina/ResourceCare;->getResourceCare(Landroid/content/Context;)Lcom/nemustech/regina/ResourceCare;

    move-result-object v0

    iput-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    .line 33
    invoke-virtual {p1}, Lcom/nemustech/regina/ReginaLauncher;->getReginaPref()Lcom/nemustech/regina/ReginaPreference;

    move-result-object v0

    iput-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mReginaPref:Lcom/nemustech/regina/ReginaPreference;

    .line 34
    return-void
.end method

.method static synthetic access$000(Lcom/nemustech/regina/ImagePlater;)Lcom/nemustech/regina/ReginaLauncher;
    .locals 1
    .parameter "x0"

    .prologue
    .line 16
    iget-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mReginaLauncher:Lcom/nemustech/regina/ReginaLauncher;

    return-object v0
.end method


# virtual methods
.method public createShortCutImage(Landroid/graphics/Bitmap;Ljava/lang/String;)Landroid/graphics/Bitmap;
    .locals 34
    .parameter "iconBmp"
    .parameter "iconName"

    .prologue
    .line 130
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutWidth()I

    move-result v27

    .line 131
    .local v27, shortcutWidth:I
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutHeight()I

    move-result v26

    .line 133
    .local v26, shortcutHeight:I
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutTextTop()I

    move-result v31

    .line 134
    .local v31, textTop:I
    new-instance v25, Landroid/graphics/Paint;

    const/4 v6, 0x1

    move-object/from16 v0, v25

    move v1, v6

    invoke-direct {v0, v1}, Landroid/graphics/Paint;-><init>(I)V

    .line 135
    .local v25, paint:Landroid/graphics/Paint;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const/high16 v7, 0x105

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v13

    .local v13, appIconHeight:I
    move v14, v13

    .line 137
    .local v14, appIconWidth:I
    sget-object v6, Lcom/nemustech/regina/ImagePlater;->BMP_CONFIG:Landroid/graphics/Bitmap$Config;

    move/from16 v0, v27

    move/from16 v1, v26

    move-object v2, v6

    invoke-static {v0, v1, v2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v17

    .line 138
    .local v17, bmpTarget:Landroid/graphics/Bitmap;
    new-instance v18, Landroid/graphics/Canvas;

    move-object/from16 v0, v18

    move-object/from16 v1, v17

    invoke-direct {v0, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 141
    .local v18, canvas:Landroid/graphics/Canvas;
    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v6

    if-ne v6, v14, :cond_0

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v6

    if-eq v6, v13, :cond_1

    .line 142
    :cond_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mSrcRect:Landroid/graphics/Rect;

    move-object v6, v0

    const/4 v7, 0x0

    const/4 v8, 0x0

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v9

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v10

    invoke-virtual {v6, v7, v8, v9, v10}, Landroid/graphics/Rect;->set(IIII)V

    .line 143
    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    sub-int/2addr v6, v14

    div-int/lit8 v20, v6, 0x2

    .line 144
    .local v20, dstLeft:I
    const/16 v21, 0x0

    .line 145
    .local v21, dstTop:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mDstRect:Landroid/graphics/Rect;

    move-object v6, v0

    add-int v7, v20, v14

    add-int v8, v21, v13

    move-object v0, v6

    move/from16 v1, v20

    move/from16 v2, v21

    move v3, v7

    move v4, v8

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Rect;->set(IIII)V

    .line 146
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mSrcRect:Landroid/graphics/Rect;

    move-object v6, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mDstRect:Landroid/graphics/Rect;

    move-object v7, v0

    move-object/from16 v0, v18

    move-object/from16 v1, p1

    move-object v2, v6

    move-object v3, v7

    move-object/from16 v4, v25

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    .line 151
    .end local v20           #dstLeft:I
    .end local v21           #dstTop:I
    :goto_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f06006f

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v6

    int-to-float v6, v6

    move-object/from16 v0, v25

    move v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 154
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f050002

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v28

    .line 155
    .local v28, textBackColor:I
    move-object/from16 v0, v25

    move/from16 v1, v28

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 156
    new-instance v6, Landroid/graphics/RectF;

    const/4 v7, 0x0

    move/from16 v0, v31

    int-to-float v0, v0

    move v8, v0

    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getWidth()I

    move-result v9

    int-to-float v9, v9

    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getHeight()I

    move-result v10

    int-to-float v10, v10

    invoke-direct {v6, v7, v8, v9, v10}, Landroid/graphics/RectF;-><init>(FFFF)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v7, v0

    const v8, 0x7f06006e

    invoke-virtual {v7, v8}, Lcom/nemustech/regina/ResourceCare;->getDimensionF(I)F

    move-result v7

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v8, v0

    const v9, 0x7f06006e

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ResourceCare;->getDimensionF(I)F

    move-result v8

    move-object/from16 v0, v18

    move-object v1, v6

    move v2, v7

    move v3, v8

    move-object/from16 v4, v25

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V

    .line 161
    if-eqz p2, :cond_3

    .line 164
    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Paint;->ascent()F

    move-result v6

    neg-float v6, v6

    float-to-double v6, v6

    invoke-static {v6, v7}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v6

    move-wide v0, v6

    double-to-int v0, v0

    move/from16 v16, v0

    .line 165
    .local v16, ascent:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f060070

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v30

    .line 168
    .local v30, textLeftMargin:I
    invoke-virtual/range {p2 .. p2}, Ljava/lang/String;->length()I

    move-result v6

    move v0, v6

    new-array v0, v0, [F

    move-object/from16 v33, v0

    .line 169
    .local v33, widths:[F
    move-object/from16 v0, v25

    move-object/from16 v1, p2

    move-object/from16 v2, v33

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Paint;->getTextWidths(Ljava/lang/String;[F)I

    .line 170
    const/16 v32, 0x0

    .line 171
    .local v32, totalWidth:F
    move-object/from16 v15, v33

    .local v15, arr$:[F
    move-object v0, v15

    array-length v0, v0

    move/from16 v24, v0

    .local v24, len$:I
    const/16 v23, 0x0

    .local v23, i$:I
    :goto_1
    move/from16 v0, v23

    move/from16 v1, v24

    if-ge v0, v1, :cond_2

    aget v22, v15, v23

    .line 172
    .local v22, f:F
    add-float v32, v32, v22

    .line 171
    add-int/lit8 v23, v23, 0x1

    goto :goto_1

    .line 148
    .end local v15           #arr$:[F
    .end local v16           #ascent:I
    .end local v22           #f:F
    .end local v23           #i$:I
    .end local v24           #len$:I
    .end local v28           #textBackColor:I
    .end local v30           #textLeftMargin:I
    .end local v32           #totalWidth:F
    .end local v33           #widths:[F
    :cond_1
    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v7

    sub-int/2addr v6, v7

    div-int/lit8 v6, v6, 0x2

    int-to-float v6, v6

    const/4 v7, 0x0

    move-object/from16 v0, v18

    move-object/from16 v1, p1

    move v2, v6

    move v3, v7

    move-object/from16 v4, v25

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    goto/16 :goto_0

    .line 175
    .restart local v15       #arr$:[F
    .restart local v16       #ascent:I
    .restart local v23       #i$:I
    .restart local v24       #len$:I
    .restart local v28       #textBackColor:I
    .restart local v30       #textLeftMargin:I
    .restart local v32       #totalWidth:F
    .restart local v33       #widths:[F
    :cond_2
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f050001

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v29

    .line 176
    .local v29, textColor:I
    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    sub-int v19, v6, v30

    .line 177
    .local v19, diffWidth:I
    move/from16 v0, v19

    int-to-float v0, v0

    move v6, v0

    cmpl-float v6, v32, v6

    if-ltz v6, :cond_4

    .line 178
    new-instance v5, Landroid/graphics/LinearGradient;

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual/range {v18 .. v18}, Landroid/graphics/Canvas;->getWidth()I

    move-result v8

    int-to-float v8, v8

    const/4 v9, 0x0

    const/4 v10, 0x5

    new-array v10, v10, [I

    const/4 v11, 0x0

    aput v29, v10, v11

    const/4 v11, 0x1

    aput v29, v10, v11

    const/4 v11, 0x2

    aput v29, v10, v11

    const/4 v11, 0x3

    aput v29, v10, v11

    const/4 v11, 0x4

    aput v28, v10, v11

    const/4 v11, 0x0

    sget-object v12, Landroid/graphics/Shader$TileMode;->CLAMP:Landroid/graphics/Shader$TileMode;

    invoke-direct/range {v5 .. v12}, Landroid/graphics/LinearGradient;-><init>(FFFF[I[FLandroid/graphics/Shader$TileMode;)V

    .line 180
    .local v5, shader:Landroid/graphics/Shader;
    move-object/from16 v0, v25

    move-object v1, v5

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setShader(Landroid/graphics/Shader;)Landroid/graphics/Shader;

    .line 181
    sget-object v6, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    move-object/from16 v0, v25

    move-object v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 182
    move-object/from16 v0, v25

    move/from16 v1, v29

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 183
    move/from16 v0, v30

    int-to-float v0, v0

    move v6, v0

    add-int v7, v31, v16

    int-to-float v7, v7

    move-object/from16 v0, v18

    move-object/from16 v1, p2

    move v2, v6

    move v3, v7

    move-object/from16 v4, v25

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 193
    .end local v5           #shader:Landroid/graphics/Shader;
    .end local v15           #arr$:[F
    .end local v16           #ascent:I
    .end local v19           #diffWidth:I
    .end local v23           #i$:I
    .end local v24           #len$:I
    .end local v29           #textColor:I
    .end local v30           #textLeftMargin:I
    .end local v32           #totalWidth:F
    .end local v33           #widths:[F
    :cond_3
    :goto_2
    return-object v17

    .line 185
    .restart local v15       #arr$:[F
    .restart local v16       #ascent:I
    .restart local v19       #diffWidth:I
    .restart local v23       #i$:I
    .restart local v24       #len$:I
    .restart local v29       #textColor:I
    .restart local v30       #textLeftMargin:I
    .restart local v32       #totalWidth:F
    .restart local v33       #widths:[F
    :cond_4
    move-object/from16 v0, v25

    move/from16 v1, v29

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 186
    sget-object v6, Landroid/graphics/Paint$Align;->CENTER:Landroid/graphics/Paint$Align;

    move-object/from16 v0, v25

    move-object v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 187
    div-int/lit8 v6, v27, 0x2

    int-to-float v6, v6

    add-int v7, v31, v16

    int-to-float v7, v7

    move-object/from16 v0, v18

    move-object/from16 v1, p2

    move v2, v6

    move v3, v7

    move-object/from16 v4, v25

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    goto :goto_2
.end method

.method public createShortCutImage(Landroid/graphics/drawable/Drawable;Ljava/lang/String;)Landroid/graphics/Bitmap;
    .locals 36
    .parameter "icon"
    .parameter "iconName"

    .prologue
    .line 46
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutWidth()I

    move-result v29

    .line 47
    .local v29, shortcutWidth:I
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutHeight()I

    move-result v28

    .line 49
    .local v28, shortcutHeight:I
    invoke-virtual/range {p0 .. p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutTextTop()I

    move-result v33

    .line 50
    .local v33, textTop:I
    new-instance v27, Landroid/graphics/Paint;

    const/4 v6, 0x1

    move-object/from16 v0, v27

    move v1, v6

    invoke-direct {v0, v1}, Landroid/graphics/Paint;-><init>(I)V

    .line 51
    .local v27, paint:Landroid/graphics/Paint;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const/high16 v7, 0x105

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v13

    .local v13, appIconHeight:I
    move v14, v13

    .line 56
    .local v14, appIconWidth:I
    const/16 v25, 0x0

    .line 64
    .local v25, iconBmp:Landroid/graphics/Bitmap;
    invoke-virtual/range {p1 .. p1}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v6

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v7

    sget-object v8, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {v6, v7, v8}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v25

    .line 65
    new-instance v18, Landroid/graphics/Canvas;

    move-object/from16 v0, v18

    move-object/from16 v1, v25

    invoke-direct {v0, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 66
    .local v18, c:Landroid/graphics/Canvas;
    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v8

    invoke-virtual/range {p1 .. p1}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v9

    move-object/from16 v0, p1

    move v1, v6

    move v2, v7

    move v3, v8

    move v4, v9

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 67
    move-object/from16 v0, p1

    move-object/from16 v1, v18

    invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 70
    sget-object v6, Lcom/nemustech/regina/ImagePlater;->BMP_CONFIG:Landroid/graphics/Bitmap$Config;

    move/from16 v0, v29

    move/from16 v1, v28

    move-object v2, v6

    invoke-static {v0, v1, v2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v17

    .line 71
    .local v17, bmpTarget:Landroid/graphics/Bitmap;
    new-instance v19, Landroid/graphics/Canvas;

    move-object/from16 v0, v19

    move-object/from16 v1, v17

    invoke-direct {v0, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 74
    .local v19, canvas:Landroid/graphics/Canvas;
    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v6

    if-ne v6, v14, :cond_0

    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v6

    if-eq v6, v13, :cond_1

    .line 75
    :cond_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mSrcRect:Landroid/graphics/Rect;

    move-object v6, v0

    const/4 v7, 0x0

    const/4 v8, 0x0

    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v9

    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v10

    invoke-virtual {v6, v7, v8, v9, v10}, Landroid/graphics/Rect;->set(IIII)V

    .line 76
    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    sub-int/2addr v6, v14

    div-int/lit8 v21, v6, 0x2

    .line 77
    .local v21, dstLeft:I
    const/16 v22, 0x0

    .line 78
    .local v22, dstTop:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mDstRect:Landroid/graphics/Rect;

    move-object v6, v0

    add-int v7, v21, v14

    add-int v8, v22, v13

    move-object v0, v6

    move/from16 v1, v21

    move/from16 v2, v22

    move v3, v7

    move v4, v8

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Rect;->set(IIII)V

    .line 79
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mSrcRect:Landroid/graphics/Rect;

    move-object v6, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mDstRect:Landroid/graphics/Rect;

    move-object v7, v0

    move-object/from16 v0, v19

    move-object/from16 v1, v25

    move-object v2, v6

    move-object v3, v7

    move-object/from16 v4, v27

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    .line 84
    .end local v21           #dstLeft:I
    .end local v22           #dstTop:I
    :goto_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f06006f

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v6

    int-to-float v6, v6

    move-object/from16 v0, v27

    move v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 87
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f050002

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v30

    .line 88
    .local v30, textBackColor:I
    move-object/from16 v0, v27

    move/from16 v1, v30

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 89
    new-instance v6, Landroid/graphics/RectF;

    const/4 v7, 0x0

    move/from16 v0, v33

    int-to-float v0, v0

    move v8, v0

    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getWidth()I

    move-result v9

    int-to-float v9, v9

    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getHeight()I

    move-result v10

    int-to-float v10, v10

    invoke-direct {v6, v7, v8, v9, v10}, Landroid/graphics/RectF;-><init>(FFFF)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v7, v0

    const v8, 0x7f06006e

    invoke-virtual {v7, v8}, Lcom/nemustech/regina/ResourceCare;->getDimensionF(I)F

    move-result v7

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v8, v0

    const v9, 0x7f06006e

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ResourceCare;->getDimensionF(I)F

    move-result v8

    move-object/from16 v0, v19

    move-object v1, v6

    move v2, v7

    move v3, v8

    move-object/from16 v4, v27

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawRoundRect(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V

    .line 94
    if-eqz p2, :cond_3

    .line 97
    invoke-virtual/range {v27 .. v27}, Landroid/graphics/Paint;->ascent()F

    move-result v6

    neg-float v6, v6

    float-to-double v6, v6

    invoke-static {v6, v7}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v6

    move-wide v0, v6

    double-to-int v0, v0

    move/from16 v16, v0

    .line 98
    .local v16, ascent:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f060070

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v32

    .line 101
    .local v32, textLeftMargin:I
    invoke-virtual/range {p2 .. p2}, Ljava/lang/String;->length()I

    move-result v6

    move v0, v6

    new-array v0, v0, [F

    move-object/from16 v35, v0

    .line 102
    .local v35, widths:[F
    move-object/from16 v0, v27

    move-object/from16 v1, p2

    move-object/from16 v2, v35

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Paint;->getTextWidths(Ljava/lang/String;[F)I

    .line 103
    const/16 v34, 0x0

    .line 104
    .local v34, totalWidth:F
    move-object/from16 v15, v35

    .local v15, arr$:[F
    move-object v0, v15

    array-length v0, v0

    move/from16 v26, v0

    .local v26, len$:I
    const/16 v24, 0x0

    .local v24, i$:I
    :goto_1
    move/from16 v0, v24

    move/from16 v1, v26

    if-ge v0, v1, :cond_2

    aget v23, v15, v24

    .line 105
    .local v23, f:F
    add-float v34, v34, v23

    .line 104
    add-int/lit8 v24, v24, 0x1

    goto :goto_1

    .line 81
    .end local v15           #arr$:[F
    .end local v16           #ascent:I
    .end local v23           #f:F
    .end local v24           #i$:I
    .end local v26           #len$:I
    .end local v30           #textBackColor:I
    .end local v32           #textLeftMargin:I
    .end local v34           #totalWidth:F
    .end local v35           #widths:[F
    :cond_1
    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    invoke-virtual/range {v25 .. v25}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v7

    sub-int/2addr v6, v7

    div-int/lit8 v6, v6, 0x2

    int-to-float v6, v6

    const/4 v7, 0x0

    move-object/from16 v0, v19

    move-object/from16 v1, v25

    move v2, v6

    move v3, v7

    move-object/from16 v4, v27

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    goto/16 :goto_0

    .line 108
    .restart local v15       #arr$:[F
    .restart local v16       #ascent:I
    .restart local v24       #i$:I
    .restart local v26       #len$:I
    .restart local v30       #textBackColor:I
    .restart local v32       #textLeftMargin:I
    .restart local v34       #totalWidth:F
    .restart local v35       #widths:[F
    :cond_2
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    move-object v6, v0

    const v7, 0x7f050001

    invoke-virtual {v6, v7}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v31

    .line 109
    .local v31, textColor:I
    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getWidth()I

    move-result v6

    sub-int v20, v6, v32

    .line 110
    .local v20, diffWidth:I
    move/from16 v0, v20

    int-to-float v0, v0

    move v6, v0

    cmpl-float v6, v34, v6

    if-ltz v6, :cond_4

    .line 111
    new-instance v5, Landroid/graphics/LinearGradient;

    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-virtual/range {v19 .. v19}, Landroid/graphics/Canvas;->getWidth()I

    move-result v8

    int-to-float v8, v8

    const/4 v9, 0x0

    const/4 v10, 0x5

    new-array v10, v10, [I

    const/4 v11, 0x0

    aput v31, v10, v11

    const/4 v11, 0x1

    aput v31, v10, v11

    const/4 v11, 0x2

    aput v31, v10, v11

    const/4 v11, 0x3

    aput v31, v10, v11

    const/4 v11, 0x4

    aput v30, v10, v11

    const/4 v11, 0x0

    sget-object v12, Landroid/graphics/Shader$TileMode;->CLAMP:Landroid/graphics/Shader$TileMode;

    invoke-direct/range {v5 .. v12}, Landroid/graphics/LinearGradient;-><init>(FFFF[I[FLandroid/graphics/Shader$TileMode;)V

    .line 113
    .local v5, shader:Landroid/graphics/Shader;
    move-object/from16 v0, v27

    move-object v1, v5

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setShader(Landroid/graphics/Shader;)Landroid/graphics/Shader;

    .line 114
    sget-object v6, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    move-object/from16 v0, v27

    move-object v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 115
    move-object/from16 v0, v27

    move/from16 v1, v31

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 116
    move/from16 v0, v32

    int-to-float v0, v0

    move v6, v0

    add-int v7, v33, v16

    int-to-float v7, v7

    move-object/from16 v0, v19

    move-object/from16 v1, p2

    move v2, v6

    move v3, v7

    move-object/from16 v4, v27

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 126
    .end local v5           #shader:Landroid/graphics/Shader;
    .end local v15           #arr$:[F
    .end local v16           #ascent:I
    .end local v20           #diffWidth:I
    .end local v24           #i$:I
    .end local v26           #len$:I
    .end local v31           #textColor:I
    .end local v32           #textLeftMargin:I
    .end local v34           #totalWidth:F
    .end local v35           #widths:[F
    :cond_3
    :goto_2
    return-object v17

    .line 118
    .restart local v15       #arr$:[F
    .restart local v16       #ascent:I
    .restart local v20       #diffWidth:I
    .restart local v24       #i$:I
    .restart local v26       #len$:I
    .restart local v31       #textColor:I
    .restart local v32       #textLeftMargin:I
    .restart local v34       #totalWidth:F
    .restart local v35       #widths:[F
    :cond_4
    move-object/from16 v0, v27

    move/from16 v1, v31

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 119
    sget-object v6, Landroid/graphics/Paint$Align;->CENTER:Landroid/graphics/Paint$Align;

    move-object/from16 v0, v27

    move-object v1, v6

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 120
    div-int/lit8 v6, v29, 0x2

    int-to-float v6, v6

    add-int v7, v33, v16

    int-to-float v7, v7

    move-object/from16 v0, v19

    move-object/from16 v1, p2

    move v2, v6

    move v3, v7

    move-object/from16 v4, v27

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    goto :goto_2
.end method

.method public getIconHeight()I
    .locals 2

    .prologue
    .line 254
    iget-object v1, p0, Lcom/nemustech/regina/ImagePlater;->mReginaLauncher:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v1}, Lcom/nemustech/regina/RUtils;->getDefaultIcon(Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 255
    .local v0, d:Landroid/graphics/drawable/Drawable;
    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v1

    return v1
.end method

.method public getIconWidth()I
    .locals 2

    .prologue
    .line 249
    iget-object v1, p0, Lcom/nemustech/regina/ImagePlater;->mReginaLauncher:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v1}, Lcom/nemustech/regina/RUtils;->getDefaultIcon(Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 250
    .local v0, d:Landroid/graphics/drawable/Drawable;
    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v1

    return v1
.end method

.method public getShortcutHeight()I
    .locals 4

    .prologue
    .line 243
    invoke-virtual {p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutWidth()I

    move-result v0

    .line 244
    .local v0, sc_width:I
    iget-object v1, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    const v2, 0x7f06006b

    invoke-virtual {v1, v2}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v1

    add-int/2addr v1, v0

    iget-object v2, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    const v3, 0x7f06006c

    invoke-virtual {v2, v3}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v2

    add-int/2addr v1, v2

    return v1
.end method

.method public getShortcutTextTop()I
    .locals 4

    .prologue
    .line 259
    invoke-virtual {p0}, Lcom/nemustech/regina/ImagePlater;->getShortcutWidth()I

    move-result v0

    int-to-double v0, v0

    const-wide/high16 v2, 0x3ff0

    mul-double/2addr v0, v2

    double-to-int v0, v0

    iget-object v1, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    const v2, 0x7f06006b

    invoke-virtual {v1, v2}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v1

    add-int/2addr v0, v1

    return v0
.end method

.method public getShortcutWidth()I
    .locals 3

    .prologue
    .line 234
    iget-object v0, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    const v1, 0x7f060069

    invoke-virtual {v0, v1}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v0

    mul-int/lit8 v0, v0, 0x2

    iget-object v1, p0, Lcom/nemustech/regina/ImagePlater;->mResCare:Lcom/nemustech/regina/ResourceCare;

    const v2, 0x7f060068

    invoke-virtual {v1, v2}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v1

    add-int/2addr v0, v1

    return v0
.end method

.method public paintCustomPanel(Lcom/nemustech/tiffany/world/TFPanel;Lcom/nemustech/regina/ImagePlater$PaintPanelDelegate;II)V
    .locals 4
    .parameter "targetPanel"
    .parameter "painter"
    .parameter "panelWidth"
    .parameter "panelHeight"

    .prologue
    .line 199
    new-instance v2, Landroid/graphics/Paint;

    const/4 v3, 0x1

    invoke-direct {v2, v3}, Landroid/graphics/Paint;-><init>(I)V

    .line 201
    .local v2, paint:Landroid/graphics/Paint;
    sget-object v3, Lcom/nemustech/regina/ImagePlater;->BMP_CONFIG:Landroid/graphics/Bitmap$Config;

    invoke-static {p3, p4, v3}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 202
    .local v0, bmpTarget:Landroid/graphics/Bitmap;
    new-instance v1, Landroid/graphics/Canvas;

    invoke-direct {v1, v0}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 204
    .local v1, canvas:Landroid/graphics/Canvas;
    invoke-interface {p2, v1, v2}, Lcom/nemustech/regina/ImagePlater$PaintPanelDelegate;->paintPanel(Landroid/graphics/Canvas;Landroid/graphics/Paint;)V

    .line 206
    const/4 v3, 0x0

    invoke-virtual {p1, v3, v0}, Lcom/nemustech/tiffany/world/TFPanel;->setImageResource(ILandroid/graphics/Bitmap;)Z

    .line 207
    return-void
.end method

.method public plateShortcut(Lcom/nemustech/tiffany/world/TFPanel;Landroid/graphics/drawable/Drawable;Ljava/lang/String;)V
    .locals 3
    .parameter "targetPanel"
    .parameter "icon"
    .parameter "iconName"

    .prologue
    .line 37
    invoke-virtual {p0, p2, p3}, Lcom/nemustech/regina/ImagePlater;->createShortCutImage(Landroid/graphics/drawable/Drawable;Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 40
    .local v0, bmp:Landroid/graphics/Bitmap;
    const/4 v1, 0x0

    invoke-virtual {p1, v1, v0}, Lcom/nemustech/tiffany/world/TFPanel;->setImageResource(ILandroid/graphics/Bitmap;)Z

    move-result v1

    const/4 v2, 0x1

    if-ne v1, v2, :cond_0

    .line 41
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    .line 43
    :cond_0
    return-void
.end method

.method public plateTrash(Lcom/nemustech/tiffany/world/TFPanel;IIZ)V
    .locals 2
    .parameter "targetPanel"
    .parameter "trashWidth"
    .parameter "trashHeight"
    .parameter "isInverse"

    .prologue
    .line 210
    move v0, p4

    .line 211
    .local v0, theInverse:Z
    new-instance v1, Lcom/nemustech/regina/ImagePlater$1;

    invoke-direct {v1, p0, v0}, Lcom/nemustech/regina/ImagePlater$1;-><init>(Lcom/nemustech/regina/ImagePlater;Z)V

    invoke-virtual {p0, p1, v1, p2, p3}, Lcom/nemustech/regina/ImagePlater;->paintCustomPanel(Lcom/nemustech/tiffany/world/TFPanel;Lcom/nemustech/regina/ImagePlater$PaintPanelDelegate;II)V

    .line 224
    return-void
.end method
